
import java.io.*;
public class Main {
    public static void main(String[] args) {
        Reader r = null;
        try {
            r = new FileReader("E:\\java-program\\BC03\\foodinfo.txt");
        }catch (IOException e){
            e.printStackTrace();
        }
        if (r != null){
            BufferedReader br = new BufferedReader(r);
            try {
                String line = br.readLine();
                System.out.println("食物，每100克铁元素含量（毫克）");
                double max = 0.0;
                String maxName = "";
                while ((line = br.readLine()) != null){
                    String[] strs = line.split(",");
                    int weight = Integer.parseInt(strs[2]);
                    double feWeight = Double.parseDouble(strs[3]);
                    double feWeightPer100 = feWeight/weight*100;
                    if (feWeightPer100 > max){
                        max = feWeightPer100;
                        maxName = strs[0];
                    }
                    System.out.println(strs[0] + "," + feWeightPer100);
                }
                System.out.println("含量最高的食物是" + maxName + ","+ "每100克含有" + max + "毫克铁");
            }catch (IOException e){
                e.printStackTrace();
            }
        }
    }
}